﻿using MathTutorPro.Data.Entities;
using MathTutorPro.Data.DAL;
using MathTutorPro.Services.Interfaces;

namespace MathTutorPro.Services.Implementations
{
    public class ClassService: IClassService
    {
        private readonly ClassDal _classDal;

        public ClassService(ClassDal classDal)
        {
            _classDal = classDal;
        }

        public async Task<IEnumerable<Class>> GetClassByUserAsync(string teacherId)
        {
            return await _classDal.GetClassByUserAsync(teacherId);
        }

        public async Task<int> CreateClassAsync(string teacherId, string className)
        {
            var newClass = new Class
            {
                ClassName = className,
                TeacherId = teacherId
            };

            await _classDal.CreateAsync(newClass);
            return newClass.Id;
        }

        public async Task<List<string>> GetClassStudentIdsAsync(int classId)
        {
            return await _classDal.GetClassStudentIdsAsync(classId);
        }

    }
}
